<template>
  <div class="mod-tenant__tenant">
    <el-form :inline="true" :model="dataForm" @keyup.enter="getDataList()">
      <el-form-item>
        <el-input v-model="dataForm.categoryName" placeholder="档案类型" clearable></el-input>
      </el-form-item>
      <el-form-item>
        <el-input v-model="dataForm.archiveCode" placeholder="全宗号" clearable></el-input>
      </el-form-item>
      <el-form-item>
        <el-input v-model="dataForm.fileNumber" placeholder="档案编号" clearable></el-input>
      </el-form-item>
      <el-form-item>
        <el-button @click="getDataList()">{{ $t("query") }}</el-button>
      </el-form-item>
    </el-form>
    <el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" @sort-change="dataListSortChangeHandle" style="width: 100%">
      <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
      <el-table-column label="全宗号" prop="archiveCode"  header-align="center" align="center"></el-table-column>
      <el-table-column label="档号" prop="fileNumber" header-align="center" align="center"></el-table-column>
      <el-table-column label="题名" prop="title" header-align="center" align="center"></el-table-column>
      <el-table-column label="档号类型" prop="categoryName" header-align="center" align="center"></el-table-column>
      <el-table-column label="收藏日期" prop="createDate" header-align="center" align="center" width="180"></el-table-column>
      <el-table-column label="备注" prop="mag" header-align="center" align="center" width="180"></el-table-column>
      <el-table-column label="操作" fixed="right" header-align="center" align="center" width="150">
        <template v-slot="scope">
          <el-button type="text" size="small" @click="deleteHandle(scope.row.id)">取消收藏</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination style="padding: 0px 38%" :current-page="page" :page-sizes="[10, 20, 50, 100]" :page-size="limit" :total="total" layout="total, sizes, prev, pager, next, jumper" @size-change="pageSizeChangeHandle" @current-change="pageCurrentChangeHandle"> </el-pagination>
  </div>
</template>

<script lang="ts">
import useView from "@/hooks/useView";
import { defineComponent, reactive, toRefs } from "vue";
export default defineComponent({
  setup() {
    const state = reactive({
      getDataListURL: "/archive/myFavorite/page",
      getDataListIsPage: true,
      deleteURL: "/archive/myFavorite/",
      deleteIsBatch: true,
      dataForm: {
        categoryName: "",
        archiveCode: "",
        fileNumber: ""
      }
    });

    return { ...useView(state), ...toRefs(state) };
  }
});
</script>
